/*
 *  types.h
 *  Asset modeling
 *
 *  Created by Peeter Meos on 27.02.11.
 *  Copyright 2011 NC3A CAT1. All rights reserved.
 *
 */


#ifndef TYPES_H
#define TYPES_H
#endif

// General data for simulation parameters

typedef struct {
	double	sim_length;
	char	number_rw_assets;
	char	number_ga_assets;
	char	number_fw_assets;
	char	number_units;
	char	number_role2;
	
	double	casualty_rate;
	
	char	debug_mode;
} T_SIM;

// Data type for generic casualty - the main entity of this simulation

typedef struct {
	char	type;
	char	location;
	
	// The times for recordkeeping
	double	wounding_time;
	double	medevac_time;
	double	role2_time;
	
	void	*next;
} T_CASUALTY;


struct S_EVENT {
	char	type;
	double	time;
	char	unit_id;
	
	struct S_EVENT	*next;
}; 

typedef struct S_EVENT T_EVENT;

typedef struct {
	char		asset_id;
	
	char		type;
	double		loc_x;
	double		loc_y;
	T_CASUALTY	*casualties;
	
	double		speed;
	double		range;
	
	char		destination;
} T_ASSET;

typedef struct{
	char		unit_id;
	
	double		loc_x;
	double		loc_y;
	
	int			men;
	char		fw_capable;
	
	char		*name;
	T_CASUALTY	*casualties;
	char		num_casualties;
} T_UNIT;

// Stuff for casualties
extern T_CASUALTY *init_casualty(char type, char location, double wounding_time);
extern void free_casualty(T_CASUALTY *entity);


// Stuff for events
extern T_EVENT *init_event(char type, double time, char	unit_id);
extern void free_event(T_EVENT *event);


// Stuff for assets
extern T_ASSET *init_asset(char type, double loc_x, double loc_y, char asset_id);
extern void free_asset(T_ASSET *asset);

extern T_ASSET *reset_range(T_ASSET *asset);

// Stuff for units
extern T_UNIT *init_unit(double loc_x, double loc_y, int men, char *name, char fw_capable, char unit_id);
extern void free_unit(T_UNIT *unit);

extern T_UNIT **create_units();
extern T_ASSET **create_assets();

extern void free_assets(T_ASSET **units);
extern void free_units(T_UNIT **units);